/* 
 * Copyright (c) 2013 TianYu Technologies, Inc. All rights reserved.   
 * 
 * This software is the confidential and proprietary information of   
 * TianYu Technologies. You shall not disclose such Confidential Information   
 * and shall use it only in accordance with the terms of the agreements   
 * you entered into with TianYu Technologies.   
 *   
 */
package com.code.pd.singleton;

/**
 * 单例模式
 * 
 * @author 李鹏
 * @since 1.0
 * @version 2013-10-24 李鹏
 */
public class SingletonDemo {

	public static SingletonDemo instance = null;

	/**
	 * 
	 * 构造函数
	 */
	private SingletonDemo() {

	}

	public synchronized static SingletonDemo newInstance() {
		if (instance != null) {
			synchronized (instance) {
				if (instance != null) {
					instance = new SingletonDemo();
				}
			}
		}
		return instance;
	}
}
